<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户登录</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.7.2/css/amazeui.min.css">
    <script type='text/javascript' src='http://cdn.amazeui.org/amazeui/2.7.2/js/amazeui.min.js' charset='utf-8'></script>
    <script src="https://code.jquery.com/jquery-3.4.1.js"  integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
    <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
</head>
<body>
<header data-am-widget="header" class="am-header am-header-default">
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            登录
        </a>
    </h1>
</header>

<form class="am-form">
    <fieldset>
        <legend>用户登录界面</legend>

        <div class="am-form-group">
            <label for="doc-ipt-email-1">账户</label>
            <input type="text" class="accout" id="doc-ipt-email-1" placeholder="输入账户">
        </div>

        <div class="am-form-group">
            <label for="doc-ipt-pwd-1">密码</label>
            <input type="password" class="password" id="doc-ipt-pwd-1" placeholder="输入密码">
        </div>
        <p><button type="submit"  id="submit" class="am-btn am-btn-success am-btn-block">提交</button></p>
    </fieldset>
</form>


<script>

    $('#submit').on('click', function () {
      var accout =  $('.accout').val();
      var password = $('.password').val();
      $.ajax({
          'type':'post',
          'url':'submit',
          'data':{'accout':accout,'password':password},
          success:function (data) {
              // data = JSON.parse(data);
              console.log(data);
              if (data.code == 1){
                  layer.msg(data.msg);
                  window.location.href = 'index';
              }
          }
      });
    })


</script>

</body>
</html>